package main

import (
	"database/sql"
	_ "github.com/go-sql-driver/mysql"
	"log"
	"strings"
)

var Db *sql.DB

func DaoInit(pass string) {
	password := strings.TrimSpace(pass)
	dataSource := "root:" + password + "@tcp(localhost:3306)/schoolrecruit?charset=utf8&parseTime=True&loc=Local"
	db, err := sql.Open("mysql", dataSource)
	if err != nil{
		log.Fatalln(err)
	}

	Db = db
	Db.SetMaxIdleConns(20)
	Db.SetMaxOpenConns(20)

}
